/**
 * Created by 小敏哥 on 2017/7/14.
 */
import React, {Component} from 'react';
import style from './messageContent.scss';
import IconText from '../calculatorOfYearlyCheck/iconText';
import SendCxytjMessage from '../../utils/sendCxytjMessage';
class MessageContent extends Component {
    constructor(props) {
        super(props);
    }

    /*getDate(){
        let date=new Date();
        return date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate();
    }*/

    render(){
        return <div className={style.container}>
            <div className={style.carNumberContent}>
                <IconText className={style.carNumber}  imgUrl="./images/carNumber.png" text={this.props.carNumber}/>
            </div>
            <div className={style.table}>
                <div className={style.row}>
                    <div>车辆注册日期</div>
                    <div>{this.props.registerDate}</div>
                </div>
                <div className={style.row}>
                    <div>车辆可办日期</div>
                    <div>{this.props.nextDate}</div>
                </div>
            </div>
            <div className={style.warnningMessage}>
                <div className={style.message}>
                    <div>{this.props.state==0?'暂时无法办理年检':'车辆已强制报废，无可年检'}</div>
                    <div>{this.props.state==0?'距车辆年检可预约周期还有':'该车辆年检已连续逾期三次'}</div>
                </div>
                <div className={style.warning}>
                    {
                        this.props.state==0?<div>
                                <div>{this.props.days}</div>
                                <div>天</div></div>:<img src="./images/process-error-icon.png"/>
                    }
                </div>
            </div>
           {/* <div className={style.tipsContainer}>
                <div className={style.underLine}></div>
                <div className={style.tips}><img src="./images/be-careful.png"/><div>{this.props.state==0?'暂时无法办理年检':'车辆已强制报废，无可年检'}</div></div>
                <div className={style.underLine}></div>
            </div>*/}
            <button onClick={this.props.buttonClick}>已知晓</button>
            <div className={style.somethingWrong}>
                <span>年检时间有误?</span>
                {/*此处由于弹窗控件独立于reactRouter之外，无法使用reactRouter的跳转方法，故使用a标签跳转*/}
                <a href={`#/updateCarInfo/${this.props.carNumber}/${this.props.carId}`} onClick={()=>{
                    //发送埋点
                    SendCxytjMessage.sendMessage({
                        eventId: 'H5_E_Interspection_Homepage_Popup_Clickedit', //事件标记
                    });
                }
                }>立即修改</a>
            </div>
        </div>
    }
}

export default MessageContent